Virtual computing environments provide flexibility to computer users and administrators in distributing and allocating computing resources. For example, the Microsoft® Hyper-V virtualization product in variants of the WINDOWS® Server 2008 operating systems supports creating and executing one or more partitions, or virtual machines, on a single computer. A guest operating system, such as variants of the WINDOWS® operating systems developed by the Microsoft Corporation, may be installed on each partition and application programs may execute on the operating system. Software, whether the guest operating system or applications, that was developed to be executed on physical hardware may be executed without modification on a partition, because the hypervisor environment provides interfaces similar to those provided by hardware devices to software components executing on the hardware. Though because they are virtual, partitions may easily be created with different capabilities to serve different purposes, including with differing amounts of virtual memory, with different number or types of virtual processors, and with different types of virtual hardware devices.
Virtualization allows hardware resources to be shared among the software executing in different partitions, with the allocation of those hardware resources flexibly set as the partitions are established. Moreover, because a virtualization environment may present a consistent virtual interface to an operating system regardless of the underlying hardware on which it is executing, virtualization also allows for easy migration of software components from one machine, whether virtual or physical, to another, as needs or computing resources change.
Some of the hardware devices that may be virtualized by a virtualization platform include timer devices. Operating systems or user-level applications may have a need for a high-resolution timer, or a reference timer. In some computing environments, support for a reference timer may be provided by a hardware device in the computer. Various types of hardware devices may be used to support a hardware timer. For example, timer support may be provided by an Advanced Configuration and Power Interface (ACPI) Power Management (PM) timer, as is known in the art.
As another example, timer support may be provided by an invariant Time Stamp Counter (TSC) that is included in modern microprocessors. Unlike a variant TSC, which may exhibit a change in timer resolution or frequency, caused, for example, by changes or interruptions to the core frequency of the processor due to processor power management features, an invariant TSC has a frequency that stays fixed for a given processor. An invariant TSC may therefore serve as a good source for support for a reference timer.
In a virtualized environment, attempts to access a hardware component not emulated as part of a virtual processor are intercepted by the virtualization platform. These intercepts avoid changes to hardware devices that could disrupt operations of software in other partitions that use the same hardware devices or even the virtualization platform itself. In a conventional virtualization platform, such an intercept may occur if a guest operating system executing in a partition attempts to access an ACPI timer. Though, in some virtualized environments, a virtual processor may emulate an invariant time stamp counter so that a guest operating system can access a virtual time stamp counter without an intercept to the virtualization platform.